home *** CD-ROM | disk | FTP | other *** search
Wrap
//------------------------------------------------------------------------ // // Text Table.wfm // // This form works with the Text Table Data Module to demonstrate // how to use a custom database class. While the form appears to // use a standard database, it is actually bypassing BDE to edit // a text file through a custom query class. The entryfield uses // a standard dataLink and the button's call delete() and count() // methods as if the rowset were working with a native BDE or // SQL-Link rowset. The custom query contains implementations // for the following rowset methods: beginAppend(), bookmark(), // count(), delete(), first(), goto(), last(), next() and save(). // // Note: Updates require exclusive use of the "Text Table.txt" file // and will fail if the Project Viewer is currently on a Form // View of this form or a Source View of "Text Table.txt". // // Dependencies: Text Table.dmd // Text Table.txt // // Visual dBASE Samples Group // // $Revision: 1.8 $ // // Copyright (c) 1997, Borland International, Inc. // All rights reserved. // //------------------------------------------------------------------------ // SET TALK OFF ** END HEADER -- do not remove this line // // Generated on 09/17/97 // parameter bModal local f f = new TextTableForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class TextTableForm of FORM with (this) onClose = {;this.rowset.parent.active = false} height = 14.4091 left = 24 top = 0 width = 58.1429 text = "Text Table" scaleFontSize = 8 scaleFontBold = false endwith this.DMDTEXT = new DATAMODREF() this.DMDTEXT.Parent = this With (this.DMDTEXT) Filename = "TEXT TABLE.DMD" DataModClass = "TextTableDataModule" Share = 0 Active = True EndWith this.TEXTTEXTFIELD1 = new TEXT(this) with (this.TEXTTEXTFIELD1) height = 0.8182 left = 1 top = 1 width = 18 metric = 0 colorNormal = "BtnText" fontSize = 8 text = "Text field:" endwith this.ENTRYTEXTFIELD = new ENTRYFIELD(this) with (this.ENTRYTEXTFIELD) height = 1 left = 1 top = 2 width = 56 metric = 0 dataLink = this.dmdtext.ref.textquery.rowset.fields["TextField"] fontSize = 8 validRequired = true borderStyle = 7 endwith this.BUTTONDELETE = new PUSHBUTTON(this) with (this.BUTTONDELETE) onClick = class::BUTTONDELETE_ONCLICK height = 1.1818 left = 1 top = 4 width = 16 text = "Delete Row" metric = 0 fontSize = 8 group = true endwith this.BUTTONCOUNT = new PUSHBUTTON(this) with (this.BUTTONCOUNT) onClick = class::BUTTONCOUNT_ONCLICK height = 1.1818 left = 18 top = 4 width = 16 text = "Count Rows..." metric = 0 fontSize = 8 group = true endwith this.TEXTHELP = new TEXT(this) with (this.TEXTHELP) height = 8 left = 1 top = 6 width = 56 metric = 0 colorNormal = "BtnText" fontSize = 8 text = "This form works with the Text Table Data Module to demonstrate how to use a custom database class. While the form appears to use a standard database, it is actually bypassing BDE to edit a text file through a custom query class. The entryfield uses a stan"; + "dard dataLink and the button's call delete() and count() methods as if the rowset were working with a native BDE or SQL-Link rowset. The custom query contains implementations for the following rowset methods: beginAppend(), bookmark(), count(), delete(), f"; + "irst(), goto(), last(), next() and save()." borderStyle = 2 endwith this.rowset = this.dmdtext.ref.textquery.rowset // {Linked Method} form.buttoncount.onClick function BUTTONCOUNT_onClick local sCount sCount = LTRIM( STR( this.form.rowset.count() ) ) MSGBOX("Total number of rows counted: " + sCount, ; "Counted Rows") return (sCount) // {Linked Method} form.buttondelete.onClick function BUTTONDELETE_onClick local bDelete bDelete = false if ( MSGBOX("You are about to delete the row." ; + CHR(13) ; + "Click Yes to delete the current row.", ; "Text Table", ; 4) == 6 ) bDelete := this.form.rowset.delete() endif return ( bDelete ) endclass